<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
</head>
<body>
	<div id="moduleHtml">
	 <div id="filePanelContainter">
	   <div id="fileNameContainter">
	     <div id="fileName"></div>
	     <a  id="fileDownDom"  href="" target="_blank">下载这个文件</a>
	   </div>
	   <div id="filePic">
	     <img id="filePicDom" alt="" src=""  />
	   </div>
	  </div>
	</div>
</body>
  <script>
  //cofit_module_js
    Cofit.moduleSourceCode.file_panel=function(dom){
      var module = {
        dom : $(dom) ,        
        inited : false ,
        //显示
        show : function( file ){//file = 要展示的文件
		          var dom=$(module.dom).clone();
		          var containter=dom.find("#filePanelContainter");
		          
        	    //初始化
		          $("body").append(dom);
		          $(dom).window({    
		        	    title: "查看文件 [ "+file.name+" ]",    
		        	    width: 640,    
		        	    height: 480,    
		        	    closed: false ,    
		        	    cache: false ,    
		        	    modal: false ,
		        	});

		          containter.find("#fileName").html(file.name);
		          containter.find("#fileDownDom").attr("href","./file/down_file/"+file.id);
	          
		          //可以直接预览的图片格式
		          var picFileType=[ "gif" , "jpeg" , "jpg" , "png" , "bmp"]
		          //不能直接预览则显示占位符
		          var filePicSrc="./static/img/file_pic_default.png"
		          for( var i in picFileType ){
		        	  if( picFileType[i] == file.type ){
		        		  filePicSrc="./file/down_file/"+file.id;
		        	  }
		          }
		          containter.find("#filePicDom").attr("src",filePicSrc);
		          module.inited=true;
        },
      };
      return module;
    };
  //cofit_module_js
  </script>
</html>